package com.ding.clientserver

import com.ding.clientserver.pojo.Token
import org.junit.Test
import org.junit.runner.RunWith
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.http.HttpEntity
import org.springframework.http.HttpHeaders
import org.springframework.http.HttpMessage
import org.springframework.http.HttpMethod
import org.springframework.http.ResponseEntity
import org.springframework.test.context.junit4.SpringRunner
import org.springframework.util.LinkedMultiValueMap
import org.springframework.util.MultiValueMap
import org.springframework.web.client.RestTemplate

class ClientServerApplicationTests {

    @Test
    void t() {
        RestTemplate rest=new RestTemplate()
       // String authorization="bearer 00337674-aaf8-47bb-ade1-8773cd54b798"

        def headers = new HttpHeaders()
        //headers.set('Authorization',authorization)
        HttpEntity<String> httpEntity=new HttpEntity<>(headers)

        ResponseEntity<Token> responseEntity= rest.exchange('http://localhost/n', HttpMethod.GET, httpEntity, Token.class)

        println(responseEntity.getBody())

        def object = rest.getForObject('http://localhost/n', Token.class)
        println(object)

    }

}
